import {
  ElButton,
  ElDialog,
  ElForm,
  ElFormItem,
  ElIcon,
  ElImage,
  ElInput,
  ElMenu,
  ElMenuItem,
  ElCarousel,
  ElCarouselItem,
} from 'element-plus'
import VueLazyloadNext from 'vue-lazyload-next'

const EMPTY_IMG =
  ''
export default {
  install(Vue: any) {
    const components = [
      ElButton,
      ElDialog,
      ElForm,
      ElFormItem,
      ElIcon,
      ElImage,
      ElInput,
      ElMenu,
      ElMenuItem,
      ElCarousel,
      ElCarouselItem,
    ]
    // const importComponent = import.meta.glob<{ default: unknown[] }>(
    //   '../components/base/**/*.vue',
    // ) as any
    // for (const path in importComponent) {
    //   importComponent[path]().then((componentConfig: { default: any }) => {
    //     const componentName = componentConfig.default.name
    //     Vue.component(componentName, componentConfig.default || componentConfig)
    //   })
    // }

    components.forEach(component => {
      Vue.component(component.name, component)
    })
    // Vue.use(VueLazyloadNext, {
    //   loading: EMPTY_IMG,
    //   error: EMPTY_IMG,
    // })
  },
}
